package mm.chenchen.modules.job.task;

import mm.chenchen.script.ScriptUtils;
import mm.chenchen.utils.SpringContextUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component("yuePiaoTask")
public class QiDianYuePiaoTask implements ITask {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void run(String params) {
        logger.debug("yuePiaoTask定时任务开始执行，参数为：{}", params);
        logger.debug("当前启动的配置文件为：{}", SpringContextUtil.getActiveProfile());
        if ("dev".equals(SpringContextUtil.getActiveProfile())) {
            ScriptUtils.exec("C:\\\\Users\\\\dev\\\\Desktop\\\\chenchen-fast-start\\\\chenchen-fast-start\\\\script\\\\python\\\\venv\\\\Scripts\\\\python.exe C:\\Users\\dev\\Desktop\\chenchen-fast-start\\chenchen-fast-start\\script\\python\\venv\\Include\\reptile\\qidian\\yuepiao.py >out.log");
        } else if ("prod".equals(SpringContextUtil.getActiveProfile())) {
            ScriptUtils.exec("nohup python3 /opt/scripts/python/yuepiao/yuepiao.py >./log/log.log&2>1 ");
        }
    }
}
